"""
 -*- coding: utf-8-*-
 @File: mgt_log.py
 @Author: chen
 @time: 2023/10/04/ 17:30
"""
import datetime
import logging
import os

# picture_path = os.path.join(cur_path, f"../screenshot/screenshot_{timestamp}.PNG")
# picture_path = os.path.basename(picture_path)
now = datetime.datetime.now()
cur_date = now.strftime("%Y-%m-%d")
logger = logging.getLogger(os.path.basename(__file__))
logger.setLevel(logging.DEBUG)
console_handler = logging.StreamHandler()
cur_path = os.path.dirname(os.path.abspath(__file__))
file = os.path.join(cur_path, f"../results/logs/{cur_date}.log")
file_handler = logging.FileHandler(filename=file, encoding="utf-8")
console_handler.setLevel(logging.DEBUG)
file_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s|%(filename)s:%(lineno)s|%(levelname)s|msg：%(msg)s")
console_handler.setFormatter(formatter)
file_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.addHandler(file_handler)
logger.info("*" * 69)
